<?php
class cls_General_Forms{
		
	public function code_block_starts($title,$subtitle=NULL,$data_blocks=NULL){ //center_content_format_start
		 ?>
			<!--insertion starts here!-->
			<div class="sscpost">
				<div class="sscpost-tl"></div>
				<div class="sscpost-tr"></div>
				<div class="sscpost-bl"></div>
				<div class="sscpost-br"></div>
				<div class="sscpost-tc"></div>
				<div class="sscpost-bc"></div>
				<div class="sscpost-cl"></div>
				<div class="sscpost-cr"></div>
				<div class="sscpost-cc"></div>
				<div class="sscpost-body">
				<div class="sscpost-inner sscarticle">
					<div class="sscpostmetadataheader">
						<h2 class="sscpostheader"><?php echo strtoupper($title)?></h2>
								<div class="cleared"></div>
					</div>
					
			<div class="sscpostcontent">
			<p style="text-align:justify;"></p>
			<?php if($subtitle!=NULL){ ?>
				<span style="font-size:16px;font-weight:bold; text-decoration: blink;"><center><?php echo strtoupper($title)?></center></span><br />
			<?php } ?>
			<p style="text-align:justify;"></p>
			<p style="text-align:justify;">
			<?php
	} //center_content_format_start
	
	public function code_block_ends(){//center_content_format_end
		?>
			</p>
			</div>
			<div class="cleared"></div>
			</div>
					<div class="cleared"></div>
				</div>
			</div>
			<br>
			<!--insertion ends here!-->
		 
		 <?php 
	  } //center_content_format_end  
  
	public function link_button ($button_name,$href_value){//object:link button
			?>
			<center>
			<span class="sscbutton-wrapper">
			<span class="sscbutton-l"> </span>
			<span class="sscbutton-r"> </span>
			<a class="sscbutton" href="<?php echo $href_value ?>"><?php echo $button_name?></a>
			</span></center>
			<?php
	} //object:link button

	public function submit_button ($button_name){
		//all forms should have the form name='form1'
			?>
			<center>
			<span class="sscbutton-wrapper">
			<span class="sscbutton-l"> </span>
			<span class="sscbutton-r"> </span>
			<a class="sscbutton" href="javascript:submitform()"><?php echo $button_name?></a>
			</span></center>
			<?php
	} //object:submit button 
	
	public function messages($title,$err_message){ //announcement
		 ?>
			<!--insertion starts here!-->
			<div class="sscpost">
				<div class="sscpost-tl"></div>
				<div class="sscpost-tr"></div>
				<div class="sscpost-bl"></div>
				<div class="sscpost-br"></div>
				<div class="sscpost-tc"></div>
				<div class="sscpost-bc"></div>
				<div class="sscpost-cl"></div>
				<div class="sscpost-cr"></div>
				<div class="sscpost-cc"></div>
				<div class="sscpost-body">
				<div class="sscpost-inner sscarticle">
					<div class="sscpostmetadataheader">
						<h2 class="sscpostheader">Message:<?php echo $title?></h2>
								<div class="cleared"></div>
					</div>
					
			<div class="sscpostcontent">
			<p style="text-align:justify;"></p>
			<span style="font-size:16px;font-weight:bold; text-decoration: blink;"><center><?php echo $err_message?></center></span><br />
			</div>
			<div class="cleared"></div>
			</div>

					<div class="cleared"></div>
				</div>
			</div>
			<br>
			<!--insertion ends here!-->
		 
		 <?php 
	  } //mesages for erro reporting(pre-formatted,code_blocks not needed)
      public function login_form(){                                                    
          ?><center>
           <table class="cog_etry"> 
             <caption class="cog_etry">LOG-IN FORM</caption> 
              <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"> 
                <tr> <td>Username</td> <td><input name="username" type="text" value=""></input></td></tr>
                <tr> <td>Password</td> <td><input name="password" type="password" value=""></input></td></tr>
                 <tr> <td>Profile ID</td> <td><input name="profile_id" type="text" value=""></input></td></tr>
                <tr> <td>Action</td> <td><input type="submit" name="submit" value="LOGIN"></td>
              </form>
         </table>
            </center>
     <?php }
     public function header_form($title,$others){
         ?>
          <p>SORSOGON STATE COLLEGE<br>
          SORSOGON CAMPUS<br>
          <?php echo $title; ?><br>
          <?php echo $others;?> </p>
    
         <?php
     }
     
  }
  
class student_forms{
    function view_grade($grades,$yr_lvl,$semester){
              #letter head
            ?>
            
    <table class="listings">
            <caption class="cog_etry">Grades Verification (<?php echo "Year : ".$yr_lvl." Sem: ".$semester.") ";?></caption>
            <tr><th>Subject Code</th><th>Subject Title</th><th>Units</th><th>Rating</th><th>Remarks</th></tr>
            <?php
            $units=0;//used as total for units
            foreach($grades as $to_show){
                if (($count % 2<>0)){ ?> <tr class="odd">
                     <?php }else{?>
                         <tr> <?php
                } ?>
                <td><?php echo str_replace("_"," ",$to_show['subj_code']);?></td><td><?php echo $to_show['description'];?></td><td><?php echo $to_show['units'];?></td><td><?php echo $to_show['grade_1'];?></td><td><?php echo $to_show['status'];?></td></tr><?php
            $count++;
            $units=$units + $to_show['units'];
            }  ?>
            <tr><td colspan="2">Total Units</td> <td><?php echo $units;?></td><td></td><td></td></tr>
        </table>
        <form action="print_container.php" method="post">
        <input TYPE="hidden" name="yr_lvl" value="<?php echo $yr_lvl;?>"></input>
        <input TYPE="hidden" name="semester" value="<?php echo $semester;?>"></input>
        <input type="hidden" name="draft" value="YES"></input>
        <center>
        <table>
        <tr><td>  <input type="submit" name="submit" value="PRINT COG"></input></td></tr>
        </table>
      </center>
        </form>
            <?php
    }
    function student_entry_form(){
         ?>
         <center>
        <table class="cog_etry">
        <caption class="cog_etry">Inquire Subjects/Grade</caption>
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                <tr><td>Year Level</td><td><select name="yr_lvl">
                            <option value="1">First</option><option value="2">Second</option>
                            <option value="3">Third</option><option value="4">Fourth</option>
                            <option value="5">Fifth</option></td></tr>   </select>
                <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                 <tr> <td>Action</td> <td><input type="submit" name="submit" value="View Grade"></td>
            </form>    
        </table>
        </center>
        <?php
    }
    
    function student_entry_form_balance(){
         ?>
         <center>
        <table class="cog_etry">
           <caption class="cog_etry">BALANCE INQURY</caption> 
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                <tr><td>Year Level</td><td><select name="yr_lvl">
                            <option value="1">First</option><option value="2">Second</option>
                            <option value="3">Third</option><option value="4">Fourth</option>
                            <option value="5">Fifth</option></td></tr>   </select>
                <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                 <tr> <td>Action</td> <td><input type="submit" name="submit" value="My Balance"></td>
            </form>    
        </table>
        </center>
        <?php
    }
    
     function get_my_balance($assessment,$student_id,$yr_lvl,$semester){
             ?>
               <form name="form1"  action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST" id="accounting_assess"> 
                <table class="listings" >
                                <tr><th>Assessment</th><th>Amount</th></tr>
                                <input type="hidden" name="student_id" value="<?php echo $student_id;?>"></input>
                                 <input type="hidden" name="yr_lvl" value="<?php echo $yr_lvl;?>""></input>
                                  <input type="hidden" name="semester" value="<?php echo $semester;?>""></input>
                                <?php
                                #declare counter for total
                                $total_assess = 0;
                                    foreach($assessment as $babayaran){
                                        #get the value of tuition
     
                                        ?>
                                           <input type="hidden" name="descr_<?php echo $babayaran['assess_id'];?>" value="<?php echo $babayaran['assess_name']?>"

                                           <tr>
                                               <td><input onclick="return false;" type="checkbox" class="assessment" id="<?php if($babayaran['assess_id']=="0"){echo "tuition_fee";}?>" onclick="account_assess();" checked="true"  value="<?php echo $babayaran['amount'];?>"><?php echo $babayaran['assess_name'];;?></input></td>
                                               <input type="hidden" name="assess_id[]" value="<?php echo $babayaran['assess_id'];?>"></input>
                                               <td><input type="text"  onchange="change_tuition();" readonly name="amount_<?php echo $babayaran['assess_id'];?>" id="<?php if($babayaran['assess_id']=="0"){echo "tuition_fee_form";}?>" onclick="account_assess();" value="<?php echo $babayaran['amount'];?>"></input></td>
                                           </tr>
                                        <?php
                                        if($babayaran['assess_id']=="0"){
                                            $total=$total+$babayaran['amount'];
                                        }else{
                                            $total=$babayaran['amount'] + $total;
                                        }
                                    }
                                    ?>                             
                                 <tr><td>Total Amount</td> <td id="result_assess"><?php echo sprintf("%.2f",$total);?></td></tr>
                                  <tr><td>Assessment No</td> <td><input type="text" name="assess_no" value="<?php echo $assessment[0]['assess_no'];?>" readonly></input></td></tr>
                              </table>
                              </form>
                              <?php    
     }
     
}

class registar_forms{
    
    function select_drop_subjects($subjects,$data){
        ?>
        <center>
        <table class="border_all">
         <form name="form1"  action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"> 
            <tr class="title"><td>Subject Code</td><td>Description</td><td>Action</td></tr>
            <?php 
                foreach($subjects as $subject){
                    ?>
                     <tr><td><?php echo $subject['subj_code']?></td><td><?php echo $subject['description']?></td><td><select name="action_<?php echo $subject['subj_code'];?>"><option value=" ">--</option><option value="drop">DROP</option></select></td></tr>
                     <input type="hidden" name="subjects[]" value="<?php echo $subject['subj_code'];?>"></input>
                    <?php
                }
            ?>
            <tr><td style="text-align: center;" colspan="3"><input type="submit" value="DROP SUBJECTS" name="submit"></input></td></tr>
            <input type="hidden" name="student_id" value="<?php echo $data['student_id'];?>"></input>
            <input type="hidden" name="yr_lvl" value="<?php echo $data['yr_lvl'];?>"></input>
            <input type="hidden" name="semester" value="<?php echo $data['semester'];?>"></input>
         </form>
         </table>
         </center>
        <?php
    }
    
    function select_add_subjects($subject,$data){
        if(!is_array($subject)){
            die("<p class='warnings'>Cannot find records.</p>");
        }
        ?>
            <form name="form1"  action="<?php echo "print_container.php";?>" method="POST"> 
            <center>
            <table class="border_all">
                <tr class="title"><td>Subject Code</td><td>Subject Pre-requisite</td><td>Action</td></tr>
                <?php
                    foreach($subject as $subjects){
                        $cur_semester=$subjects['semester'];
                        if($cur_semester != $preced_semester){
                            ?>
                            <tr><td colspan="3" style="text-align: center;"><?php echo miscellaneous::prefix_add($subjects['yr_lvl'])." Year - ".$subjects['semester'].miscellaneous::prefix_add($subjects['semester'],"suffix")." semester"?></td></tr>
                            <?php
                        }
                        ?>
                         <tr><td><?php echo $subjects['subj_code'];?></td><td><?php echo $subjects['subj_preq'];?></td><td><select name="subj_code_<?php echo $subjects['subj_code'];?>"><option value=" ">--</option><option value="add">ADD</option></select></td></tr>
                         <input type="hidden" name="subjects[]" value="<?php echo $subjects['subj_code'];?>">
                          <input type="hidden" name="description_<?php echo $subjects['subj_code'];?>" value="<?php echo $subjects['description'];?>">
                           <input type="hidden" name="units_<?php echo $subjects['subj_code'];?>" value="<?php echo $subjects['units'];?>">
                        <?php
                        $preced_semester = $subjects['semester'];
                    }
                ?>
              <tr><td colspan="3" style="text-align: center;"><input type="submit" value="Process Subjects" name="submit"></INPUT></td></tr>  
            </table>
            </center>
            <input type="hidden" name="semester" value="<?php echo $data['semester'];?>"></input>
             <input type="hidden" name="student_id" value="<?php echo $data['student_id'];?>"></input>
            <input type="hidden" name="yr_lvl" value="<?php echo $data['yr_lvl'];?>"></input>
             <input type="hidden" name="add_allow" value="true"></input>
            </form>
        <?php
    }
    function override_subject_preq($subjects){
        ?>
          <form name="form1"  action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"> 
        <center>
            <table class="border_all">
                <caption class="cog_etry">Subjects to Add</caption>
                    <tr class="title"><td>Subject Code</td><td>Subject Prerequisite</td><td>Description</td><td>Action</td></tr>
        <?php
        foreach($subjects as $subject){
        ?>
              <tr class="title"><td style="text-align: left"><?php echo $subject['subj_code'];?></td><td><?php echo $subject['subj_preq'];?></td><td style="text-align: left"><?php echo $subject['description'];?></td><td><select name="action_<?php echo $subject['subj_code'];?>"><option value=""></option><option value="add">ADD</option></select></td></tr>
              <input type="hidden" name="subjects[]" value="<?php echo $subject['subj_code'];?>">
        <?php
        }
        ?>
        <tr><td colspan="4" style="text-align: center;"><input type="submit" name="submit" value="Add Subject"></td></tr>
            </table>
        </center>
        </form>
        <?php
    }
    function add_drop_subjects(){
        ?>
        <center>
            <table class="cog_etry">
                <caption class="cog_etry">Adding/Dropping of Subjects</caption>
                  <form name="form1"  action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"> 
                    <tr> <td>Student ID</td> <td><input name="student_id" type="text" value="<?php echo $_GET['studid'];?>"></input></td></tr> 
                    <tr><td>Year Level</td><td><select name="yr_lvl"><option <?php echo $_GET['yrlvl']=="1"?"selected":"";?> value="1">First Year</option><option <?php echo $_GET['yrlvl']=="2"?"selected":"";?> value="2">Second Year</option><option value="3" <?php echo $_GET['yrlvl']=="3"?"selected":"";?>>Third Year</option><option <?php echo $_GET['yrlvl']=="4"?"selected":"";?> value="4">Fourth Year</option><option value="1" <?php echo $_GET['yrlvl']=="5"?"selected":"";?>>Fifth Year</option></select></td></tr>
                    <tr> <td>Semester</td> <td><select name="semester"><option <?php echo $_GET['sem']=="1"?"selected":"";?>  value="1">First</option><option <?php echo $_GET['sem']=="2"?"selected":"";?> value="2">Second</option></select></td></tr>   
                         <tr><td>Action<td><input name="aksyon" type="radio" onclick="palitan_action(this.value)" value="ADD">ADD</input><input name="aksyon" type="radio" value="DROP" onclick="palitan_action(this.value)" >DROP</input></td></tr>
                         <tr><td colspan="2" style="text-align: center;"><input style="width: 40%;" type="submit" name="submit" value="ADD" id="palitan"></input></td></tr>
                  </form>
            </table>
        </center>
        <?php
    }
    
    function view_all_students($data){
        $_SESSION['page']="View All Students Profile";
       ?>
       <center>
            <table class="border_all" width="90%">
                <caption class="cog_etry">Students' Records</caption>
                <tr class="title"><td colspan="3">Total Rows: <?php echo count($data);?></td><td></td><td colspan="2"><a href="main.php?page=registrar&spec=addstudent&action=ask"><img title="Add" src="icon/icon_edit.jpg"></a><a href=""><img title="Delete" src="icon/icon_del.jpg"></a></td></tr>
                    <tr class="title"><td>No</td><td>Student Id</td><td>Name</td><td>Course-Major</td><td>Gender</td><td>Address</td></tr>
               <?php
               #this is used for the pagination
               if($_REQUEST['start']==""){
                $count=0;   
               }else{
                   $count=$_REQUEST['start'];
               }
               
                foreach($data as $listahan){
                    $count++;
                   ?>
                  <tr><td><?php echo $count;?></td><td><?php echo $listahan['stud_id'];?></td><td><?php echo $listahan['name'];?></td><td><?php echo $listahan['course']."-".$listahan['major'];?></td><td><?php echo $listahan['gender'];?></td><td><?php echo $listahan['address'];?></td></tr> 
                   <?php
               }?>     
            </table>
            <?php 
          
            ?>
       </center>
       <!-- this inserts page below the page-->      
       <?php   admin_functions::pagination_by_20();
    }
    
    function entry_form(){
        $_SESSION['page']="Evaluation Of Subjects";
        ?>
       <center> 
        <table class="cog_etry"> 
            <caption class="cog_etry">Enrollment Form</caption>      
              <form name="form1" action="<?php echo "print_container.php";?>" onsubmit="return createTarget(this.target)" target="SSC;" method="POST"> 
                <tr> <td>Student ID</td> <td><input name="student_id" type="text" value=""></input></td></tr>
                <tr><td>Year Level</td><td><select name="yr_lvl">
                            <option value="1">First</option><option value="2">Second</option>
                            <option value="3">Third</option><option value="4">Fourth</option>
                            <option value="5">Fifth</option></td></tr>   </select>
                <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                <tr> <td>Action</td> <td><input type="submit" name="submit" value="Process Subjects"></td>
                <input type="hidden" name="assessor" value="<?php echo $_SESSION['name'];?>"></input>
              </form>
         </table>
        </center> 
        
        
        <?php
    }
    
    function request_cog_lang($request=NULL){
        $_SESSION['page']=$request!='evaluation'?"Request of Certificate of Grades":"Request of Evaluation of Grades";
        admin_functions::mga_konstant($request);
        ?>
        <center>
            <table class="cog_etry"> 
                <caption class="cog_etry"><?php echo defined('titulo')?titulo:"Request for Certificate of Grades";?></caption>           
                    <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                    <tr> <td>Student ID</td> <td><input name="student_id" type="text"></input></td></tr> 
                    <tr> <td>No of Copies</td> <td><select name="copies"><?php for($i=1;$i<=10;$i++){ echo "<option>".$i."</option>";}?></select></input></td></tr>                              <tr><td>Year Level</td><td><select name="yr_lvl"><option value="1">First Year</option><option value="2">Second Year</option><option value="3">Third Year</option><option value="4">Fourth Year</option><option value="1">Fifth Year</option></select></td></tr>
                    <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>                                      <tr> <td>Action</td> <td><input type="submit" name="submit" value="<?php echo defined('submit')?submit:"Request COG";?>"></td>
                  <?php 
                  #this submits the title to be written in the collectibles accout
                  echo defined('pangaran')?pangaran:"<input type='hidden' name='pangaran' value='Certification Fee'></input>";
                  echo defined('bayad')?bayad:"<input type='hidden' name='bayad' value='50.00'></input>";
                  echo defined('assess_id')?assess_id:"<input type='hidden' name='assess_id' value='27'></input>";
                  ?>
                  
                  
                  </form>
             </table>
        </center>
        
        <?php
    }
    
    function assessed_subjects($subjects,$profile,$assessment,$year_level,$semester,$assessor){
        echo "<center>";
                #this is for the header of the form
                cls_General_Forms::header_form("Certificate of Registration",$semester==1?"First Semester 2012-2013":"Second Semester 2012-2013");
            ?>
         <table width="100%" class="listings"> 
         <tr><td colspan="2"><!-- main table -->   
                    <table align="center" width="100%">
                        <tr><td>Student</td><td><em><?php echo $profile[0]['stud_id']." ".$profile[0]['name'];?></em></td><td>OR Number</td><td><?php //echo Or number; ?></td></tr>
                        <tr><td>Course</td><td><?php echo $profile[0]['course']." ".$profile[0]['major'];?></td><td>Date</td><td><?php echo date('Y-m-d');?></td></tr>
                        <tr><td>Year Level</td><td><?php echo $year_level." ".$profile[0]['stud_type'];?></td><td>Amount Paid</td><td><?php //echo amount;?></td></tr>
                    </table>
              </td><td></td></tr>
              
           <tr><td valign="top">   
            <table class="listings" align="left" width="100%">
               
                <tr><th>Action</th><th>No<th style="text-align:left;">Subject Code</th><th>Subject Title</th><th>Units</th></tr>    
                <?php
                $count=1; //used as numbering
                $units=0;//used as total for units
                    ?>
                      <form name="form1" id="subjects_assess" action="<?php echo "main.php";?>" onsubmit="repage_enrollment();" method="POST"> 
                      
                       <input type="hidden" name="student_id" value="<?php echo $profile[0]['stud_id'];?>">
                       <!--    <input type="hidden" name="student_id" value="<?php echo $profile[0]['section'];?>"> -->
                       <input type="hidden" name="stud_type" value="<?php echo $profile[0]['stud_type'];?>">
                       <input type="hidden" name="semester" value="<?php echo $semester?>"></input>
                       <input type="hidden" name="yr_lvl" value="<?php echo $year_level;?>"> </input>
                      
                            <!-- subjects -->
                            <?php 
                                foreach($subjects as $to_show){
                                   if (($count % 2<>0)){ ?> <tr class="odd">
                                   <?php }else{?>
                                         <tr> <?php
                                        } ?>
                                            <td style="text-align: center"><input checked="true"  style="border: none;height :6pt" class="subjects" onclick="sum_units();" type="checkbox" name="total_subjects[]" value="<?php echo $to_show['units'];?>"></input></td><td style="text-align: center"><?php echo $count;?></td><td><?php echo str_replace("_"," ",$to_show['subj_code']);?></td><td><?php echo $to_show['description'];?></td><td style="text-align: center"><?php echo $to_show['units'];?></td>
                                            <input type="hidden"  name="subject_code[]?>"  value="<?php echo $to_show['subj_code'];?>"></input>
                                            <input type="hidden" name="descr_<?php echo $to_show['subj_code'];?>"  value="<?php echo $to_show['description'];?>"></input>

                                        </tr><?php                                 
                                $count++;
                                $units=$units + $to_show['units'];
                                }  ?>
                                <tr><td colspan="4">Total Units</td> <td id="result_page" style="text-align: center"><?php echo $units;?></td></tr>
                              
         </table>
         </td>
                             <input type="hidden" name="total_units" id="result_hidden" value="<?php echo $units;?>"></input>
          <td valign="top">                   
                             <table class="listings" id="assessment_table" align="right" width="85%">
                                <tr><th>Assessment</th><th>Amount</th></tr>
                                <?php
                                #used to determine what column to show for the year level
                                if($profile[0]['yr_lvl']=="1"){
                                    $yr ="first";
                                }elseif($profile[0]['yr_lvl']=="2"){
                                    $yr="second";
                                }elseif($profile[0]['yr_lvl']=="3"){
                                    $yr="third";
                                }elseif($profile[0]['yr_lvl']=="4"){
                                    $yr="fourth";
                                }else{
                                    $yr="fifth";
                                }
                                #declare counter for total
                                $total_assess = 0;
                                    foreach($assessment as $babayaran){
                                        #get the value of tuition
                                        if($babayaran['assess_id']=="0"){
                                            ?>
                                            <input type="hidden" id="tuition" name="tuition" value="<?php echo $babayaran[$yr.'_amnt'];?>"></input> 
                                            <?php
                                        }
                                        ?>
                                           <input type="hidden" name="descr_<?php echo $babayaran['assess_id'];?>" value="<?php echo $babayaran['assess_name']?>">

                                           <tr>
                                               <td><input type="checkbox"  style="border: 0;background: transparent;height :6pt" class="assessment" id="<?php if($babayaran['assess_id']=="0"){echo "tuition_fee";}?>" onclick="get_assess();" checked="true"  value="<?php if($babayaran['assess_id']=="0"){ echo $babayaran[$yr.'_amnt'] *  $units;}else{echo $babayaran[$yr.'_amnt'];} ;?>"><?php echo $babayaran['assess_name'];;?></input></td>
                                               <input type="hidden" name="assess_id[]" value="<?php echo $babayaran['assess_id'];?>"></input>
                                               <td><input style="text-align: right;width: 5em;border:none;height :12pt" type="text"  readonly  name="amount_<?php echo $babayaran['assess_id'];?>" id="<?php if($babayaran['assess_id']=="0"){echo "tuition_fee_form";}?>" onclick="get_assess();" value="<?php if($babayaran['assess_id']=="0"){ echo $babayaran[$yr.'_amnt'] *  $units;}else{echo $babayaran[$yr.'_amnt'];} ;?>"></input></td>
                                           </tr>
                                        <?php
                                        if($babayaran['assess_id']=="0"){
                                            $total=$total+($babayaran[$yr.'_amnt'] *  $units);
                                        }else{
                                            $total=$babayaran[$yr.'_amnt'] + $total;
                                        }
                                    }
                                    ?>                             
                                 <tr><td>Total Amount</td> <td style="text-align: right;" id="result_assess"><?php echo sprintf("%.2f",$total);?></td></tr>
                              </table> 
                </td></tr>
              </table>                
                                                                                                  
                               <input type="hidden" name="total_units" id="result_hidden_assess" value="<?php echo sprintf("%.2f",$total);?>"></input>
          
                            
               <div id="laen_ipakita" style="display:none">     
                    <p style="text-align: left;text-indent: 0.7in;position: absolute;bottom: 6.5in;"> I hereby certify that all the information given in this form are true and correct to the best of my knowledge.</p>   
                    <p style="text-align: left;text-indent: 1in;position: absolute;bottom: 6.1in;">Signature of Sutdent _________________</p>
                    
                   <p style="text-align: center;position:absolute;left:20px;bottom: 5.1in;">
                   ASSESSED by:<BR>
                   <BR>
                   <br>
                  <em style="text-decoration: underline;"> <?php echo $assessor;?> </em>                  
                   </p>
                   
                   <p style="position:absolute;text-align: center;right:20px;bottom: 5.1in;">
                   Reviewed/Approved by:<BR>
                   <BR>
                   <br>
                   <em style="text-decoration:underline">MARIA LOURDES G. BARROZO</em><br>
                   College Registrar                   
                   </p>
               </div>
                <input  style="position: absolute;bottom:1in" type="submit" id="mahahali" name="submit" value="Print Registration Form">
               <hr>   
    
                      </form>
                   
                
            <?php
        echo "</center>";
    }
    
    function entry_form_cert_grades(){
        $_SESSION['page']="Printing of Certificate of Grades";
        ?>
        <center>
           
            <table class="cog_etry">
                  <caption class="cog_etry">Printing of Certificate of Grades</caption>
                <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                    <tr><td>ID No</td><td><input type="text" name="student_id"></input></td></tr>
                      <tr><td>OR No</td><td><input type="text" name="or_no"></input></td></tr>
                    <tr><td>Year Level</td><td>
                        <select name="yr_lvl">
                                <option value="1">First</option><option value="2">Second</option>
                                <option value="3">Third</option><option value="4">Fourth</option>
                                <option value="5">Fifth</option></td></tr>   
                        </select>
                    <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                     <tr> <td>Action</td> <td><input type="submit" name="submit" value="Print COG"></td>
                </form>    
            </table>
        </center>
        <?php
    }
    
    function draft_cog($grades,$profile,$yr_lvl,$semester){
            #letter head
            ?>   
              <form name="form1" action="print_container.php" method="POST">
     <center>       
    <table class="listings" style="margin-left:0.1in;" width="80%">
            <tr><th>Subject Code</th><th>Subject Title</th><th>Units</th><th>Rating</th><th>Remarks</th></tr>
            <?php
            $units=0;//used as total for units
            foreach($grades as $to_show){
                if (($count % 2<>0)){ ?> <tr class="odd">
                     <?php }else{?>
                         <tr> <?php
                } ?>
                <td><?php echo str_replace("_"," ",$to_show['subj_code']);?></td><td><?php echo $to_show['description'];?></td><td style="text-align: center"><?php echo $to_show['units'];?></td><td style="text-align: center"><?php echo $to_show['grade_1'];?></td><td style="text-align: center"><?php echo $to_show['status'];?></td></tr><?php
            $count++;
            $units=$units + $to_show['units'];
            }  ?>
            <tr><td colspan="2">Total Units</td><td><?php echo $units;?></td><td></td><td></td></tr>
        </table> 
        <table id="mahahali1">
       <tr><td>Requested by:</td><td><input type="text" name="naghagad"></input></td></tr> 
       <tr><td>Purpose</td> <td><input type="text" name="purpose"></input></td></tr>
        </table>
        </center>

           <center> <input type="submit" name="submit" id="mahahali2" value="PRINT COG"></center> 
           <input type="hidden" name="student_id" value="<?php echo $profile[0]['stud_id'];?>"></input> 
           <input type="hidden" name="semester" value="<?php echo $semester;?>"> 
           <input type="hidden" name="yr_lvl" value="<?php echo $yr_lvl;?>"> 
          </form>
            <?php
    }
     
     function draft_cog_unprint($grades,$profile,$yr_lvl,$semester){
            #letter head
            ?>   
              <form name="form1" action="print_container.php" method="POST" onsubmit="return createTarget(this.target)" target="SSC;">
     <center>       
    <table class="listings">
            <tr><th>Subject Code</th><th>Subject Title</th><th>Units</th><th>Rating</th><th>Remarks</th></tr>
            <?php
            $units=0;//used as total for units
            foreach($grades as $to_show){
                if (($count % 2<>0)){ ?> <tr class="odd">
                     <?php }else{?>
                         <tr> <?php
                } ?>
                <td><?php echo str_replace("_"," ",$to_show['subj_code']);?></td><td><?php echo $to_show['description'];?></td><td><?php echo $to_show['units'];?></td><td><?php echo $to_show['grade_1'];?></td><td><?php echo $to_show['status'];?></td></tr><?php
            $count++;
            $units=$units + $to_show['units'];
            }  ?>
            <tr><td colspan="2">Total Units</td><td><?php echo $units;?></td><td></td><td></td></tr>
        </table> 
        <table id="mahahali1">
       <tr><td>Requested by:</td><td><input type="text" name="naghagad"></input></td></tr> 
       <tr><td>Purpose</td> <td><input type="text" name="purpose"></input></td></tr>
        </table>
        </center>

           <center> <input type="submit" name="submit" id="mahahali2" value="PRINT COG"></center> 
           <input type="hidden" name="student_id" value="<?php echo $profile[0]['stud_id'];?>"></input> 
           <input type="hidden" name="semester" value="<?php echo $semester;?>"> 
           <input type="hidden" name="yr_lvl" value="<?php echo $yr_lvl;?>"> 
          </form>
            <?php
    } 
     
                                             
    function entry_form_evaluation(){  
        $_SESSION['page']="Print Evaluation of Grades";                              
        #this function shows a simple form to get the student id for getting the data in prspectus
        ?>
        <center>
          <table class="cog_etry">
            <caption class="cog_etry">Evaluation Form</caption>
                <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                    <tr><td>ID No</td><td><input type="text" name="student_id"></input></td></tr>
                     <tr><td>OR No</td><td><input type="text" name="or_no"></input></td></tr>
                     <tr> <td>Action</td> <td><input type="submit" name="submit" value="PRINT EVALUATION"></td>
                </form>    
         </table>
        </center>
        <?php
    }
 function coloran($yr_lvl,$semester){
        if($yr_lvl=="1" && $semester=="1"){
            $color="red";
        }elseif($yr_lvl=="1" && $semester=="2"){
            $color="yellow";
        }else{
            
        }
        echo "bgcolor=$color";
    }
    function show_evaluation_form($grades,$student_id,$yr_lvl,$semester){
        #this function shows all the grades of students based from evaluation form
        ?>
            <table class="border_all">
                <caption class="cog_etry">Evaluation</caption>
            <tr><th>Subject Code</th><th>Subject Title</th><th>Units</th><th>Year Level</th><th>Semester</th><th>Rating</th><th>Remarks</th></tr>
            <?php
            $units=0;//used as total for units
            foreach($grades as $to_show){
                ?> <tr><td><?php echo $to_show['subj_code'];?></td><td><?php echo $to_show['description'];?></td><td><?php echo $to_show['units'];?></td><td><?php echo $to_show['yr_lvl'];?></td><td><?php echo $to_show['semester'];?></td><td><?php echo $to_show['grade_1'];?></td><td><?php echo $to_show['status'];?></td></tr><?php
          
            $units=$units + $to_show['units'];
            }  ?>
            <tr><td colspan="2">Total Units</td> <td><?php echo $units;?></td><td></td><td></td><td></td><td></td></tr>
        </table>
        <center style='margin-top: 0.5in;'>
            <form action="print_container.php" method="POST" name="form1">
                <input type="hidden" name="student_id" value="<?php echo $student_id;?>"></input>
                 <input type="hidden" name="yr_lvl" value="<?php echo $yr_lvl;?>"></input>
                  <input type="hidden" name="semester" value="<?php echo $semester;?>"></input>
                <input type="submit" name="submit" value="PRINT EVALUATION"></input>
            </form>
        </center>
        <?php
    }
    
    function show_evaluation_form_print($grades,$profile){
         #this function shows all the grades of students based from evaluation form
$degree_name = strtoupper($profile[0]['degree_name']); 
$date =  date('jS \d\a\y \o\f F Y'); 
$name =  strtoupper($profile[0]['name']);  
$excel = new download_excel("reports/evaluation.xls");
$excel->set_cell_value("A5",$degree_name);
$excel->set_cell_value("D7",$date);
$excel->set_cell_value("D8",$name);


/*
$title = <<<EOD
                 <p align="center" style="text-align: center;">
                                Republic of the Philippines<br>
                                SORSOGON STATE COLLEGE<br>
                                Sorsogon City<br>
                                Office of the College of Registrar<br>
                                <BR>
                                $degree_name 
                                </p>
          <p align="left">
          Academic Records as of <b>$date</b><br>
          STUDENT'S NAME: <b>$name</b>
          </p>  
           <center>
           <table width='100%'>
            <tr><th>Subject Code</th><th>Subject Title</th><th>Units</th><th>Year&Sem</th><th>Rating</th><th>Remarks</th></tr>
EOD;
         define('head',$title);     
                         echo head; */
                         
?>
            <?php
            $count=0;
            $units=0;//used as total for units
            $row = 11;
            
            
                   
            foreach($grades as $to_show){
                    $old_semester= $to_show['semester']; 
                    if($old_semester!=$present_semester){
                        //prepared words
                            
                        $excel->set_cell_value("B".$row,miscellaneous::prefix_add($to_show['yr_lvl'])." Year - ".$to_show['semester'].miscellaneous::prefix_add($to_show['semester'],"suffix")." semester");
                        $row++;
                    }                 
                      //used in tracing the yr_lvl and semester 
                    $excel->set_column_row_value(0,$row,str_replace("_"," ",$to_show['subj_code']));
                    $excel->set_cell_value("B".$row,$to_show['description']);
                    $excel->set_cell_value("F".$row,$to_show['units']);
                    $excel->set_cell_value("G".$row,$to_show['taken']);
                    $excel->set_cell_value("H".$row,$to_show['grade_1']);
                    $excel->set_cell_value("I".$row,$to_show['status']);
                    $units = $units + $to_show['units'];
                    $row++;
                    $present_semester=$to_show['semester'];
                /*
                ?> <tr><td><?php echo str_replace("_"," ",$to_show['subj_code']);?></td><td><?php echo $to_show['description'];?></td><td><?php echo $to_show['units'];?></td><td><?php echo $to_show['taken'];?></td><td><?php echo $to_show['grade_1'];?></td><td><?php echo $to_show['status'];?></td></tr><?php
           if($count%33==0 && $count!=0){
              echo "</table></center>";
              echo "<p style='height:0.2in'></p>";
              echo head; 
           }
            $count++;
            $units=$units + $to_show['units'];
            }  ?>
            <tr><td colspan="2">Total Units</td> <td><?php echo $units;?></td></tr>
        </table>
        <P align="left">
        Prepared and Checked by:<b> <?php echo $_SESSION['name'];?></b></p>
        <br>
        <br>
                                                    <p align="right">
                                                       Verified by:<br>
                                                       <br>
                                                       <br>
                                                       MARIA LOURDES G. BARROZO<BR>
                                                       College Registrar
                                                    </p>
        <?php                     
       */ 
    }
    $row = $row + 2;
    $excel->set_cell_value("B".$row,"Total Units");
    $excel->set_cell_value("F".$row,$units);
    $row=$row + 5;
    $excel->set_cell_value("B".$row,"Prepared and Checked by: ".$_SESSION['name']);
    $row= $row + 3;
    $excel->set_cell_value("G".$row,"Verified by:");
    $row= $row + 3;
    $excel->set_cell_value("G".$row,"MARIA LOURDES G. BARROZO");
    $row = $row +1;
    $excel->set_cell_value("G".$row,"College Registrar");
    #download
    $excel->force_download($name);
    }
   function view_enrolled_students($data){
       $_SESSION['page']="View Enrolled Students";
          ?>
                <center>
                    <table class="border_all">
                        <caption class="cog_etry">Enrolled Students <?php ?></caption>
                        <tr class="title"><td>Count</td><td>Student_id</td><td>Name</td><td>Course</td><td>Major</td><td>Year Level</td><td>Section</td><td>Subject Count</td><td>Date of Registration</td></tr>
                        <?php
                        $count=1;
                        foreach($data as $profile){
                         ?>
                           <tr><td><?php echo $count?></td><td><?php echo $profile['student_id']?></td><td><?php echo $profile['name']?></td><td><?php echo $profile['course']?></td><td><?php echo $profile['major']?></td><td><?php echo $profile['yr_lvl']?></td><td><?php echo $profile['section']?></td></td><td><?php echo count(explode("|",$profile['subject']));?></td><td><?php echo $profile['date_registration']?></td></tr>
                         <?php   
                         $count++;
                        }?>
                    </table> 
                </center>               
                <?php
   } 
}

class teacher_forms{
    function add_grade(){
         ?>
         <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">     
         <center>   
                <table class="cog_etry">
                    <caption class="cog_etry">Grade Entry Form</caption>
                    <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                        <tr> <td>ID Number</td> <td><input type="text" name="student_id"></input></td></tr>
                          <tr> <td>Subject Code</td> <td><input type="text" name="subj_code"></input></td></tr>
                             <tr> <td>Grade</td> <td><input onblur="check_num(this.value)" type="text" name="grade"></input></td></tr>
                      <tr><td>Remarks</td><td><select name="remarks">
                                    <option value="<?php echo $grade['status']?>"><?php echo $grade['status']?></option>
                                      <option value=""></option>
                                  <option value="dropped">Dropped</option>
                                  <option value="failed">Failed</option>
                                <option value="inc">Incomplete</option>
                                <option value="passed">Passed</option>
                            </select></td></tr>        
                             
                             
                <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                         <tr> <td>Action</td> <td><input type="submit" name="submit" value="<?php echo "Enter Grade";?>"></td> 
                </table>
            </center>  
         </form>
        
        
        <?php
    }
    function show_students($students,$data){
        $_SESSION['page']="Confirm Students List";
        ?>
         <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
         <center>
         <table class="border_all">
            <caption class="cog_etry">Students to List</caption>
            <tr class="title"><td>Confirm</td><td>Student ID</td><td>Name</td><td>Course/Major</td></tr>          
            <?php
                foreach($students as $student){
                    ?>
                     <tr><td style="text-align: center;"><input name="student_id[]" checked type="checkbox" value="<?php echo $student['student_id']?>"></input></td>
                     <td><?php echo $student['student_id'];?></td><td><?php echo $student['name'];?></td><td><?php echo $student['course']."-".$student['major'];?></td></tr>       
                      
                    <?php
                }
                ?>
         </table>
         <table>
         <tr><td style="padding-top: 1em;"><input type="submit" name="submit" value="Confirm Students List"></input></td></tr>
         </table>
         </center>
         <input type="hidden" name="semester" value="<?php echo $data['semester'];?>"></input>
         <input type="hidden" name="section" value="<?php echo $data['section'];?>"></input>
         <input type="hidden" name="subject" value="<?php echo $data['subj_code'];?>"></input>
         </form>
        
        
        <?php
    }
    function add_teacher(){
        $_SESSION['page']="Add Teacher";
        ?>
        <center>
            <table class="cog_etry">
            <caption class="cog_etry">Add Teacher To List</caption>
             <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                <tr><td>ID</td><td><input type="text" name="teacher_id"></input></td></tr>    
                <tr> <td>Last Name</td><td><input style="width: 75%;" type="text" name="lname"></input></td></tr>
                    <tr> <td>First Name</td><td><input style="width: 75%;" type="text" name="fname"></input></td></tr>
                    <tr> <td>Middle Name</td><td><input style="width: 75%;" type="text" name="mname"></input></td></tr>
                    <tr><td>Action</td><td><input type="submit" name="submit" value="Add Teacher"></input></td></tr>
             </form>
         </table>
         </center>
        <?php
    }
    
    function get_students($course,$section,$department){
        $_SESSION['page']="Teacher Gets Students";
        ?>
            <center>
            <table class="cog_etry" id="department">
            <caption class="cog_etry">Get My Students</caption>
             <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
               <tr><td>Subject Code</td><td><input name="subj_code" type="text"></input></td></tr>
               <tr><td>Department</td><td><select onchange="remove_other_dept(this.value)" name="department">
                                        <option> </option>
               <?php foreach($department as $departments){
                   echo "<option value='".strtolower($departments)."'>".$departments."</option>";
               }?></select></td></tr>
               <tr><td>Year Level</td><td><select name="yr_lvl">
                    <?php 
                    for($i=1;$i<=5;$i++){
                        echo "<option value='".$i."'>".$i."</option>";
                    }
                    ?>
               </select></td></tr>
               <tr><td>Section</td><td><select name="section"><?php
                                          foreach($section as $sections){
                                              echo "<option value='".$sections['code']."'>".$sections['code']."</option>";
                                          }
                                    ?></select></td></tr>
               <tr><td>Semester</td><td><select name="semester"><option value="1">First</option><option value="2">Second</option><option value="3">Summer</option></select></td></tr>
               <tr><TD>Courses</td><td></td></tr>
               <?php 
               foreach($course as $courses){
                    echo "<tr class='".$courses['department']."'><TD></td><td><input type='checkbox' name='course[]' value='".$courses['degreecode']."-".$courses['major']."'>".$courses['degreecode']."-".$courses['major']."</input></td></tr>";
               }
               ?>
               <Tr><td>Action</td><td><input type="submit" name="submit" value="Get Students"></input></td></tr>
               
             </form>
         </table>
         </center>
        <?php
    }
    
} 
 
class admission_forms{
   /* function log_profile($choices,$religion,$status){?>
                    <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                    <table border="0" align="left" style="margin-top:1em;;margin:1em 20% 0 20%;padding-left:2em;">
                        <caption class="cog_etry">APPLICATION FOR ADMISSION CREDENTIALS</caption>
                        <tr><td colspan="4"><i>Please hover your mouse pointer on a specific field to provide you with hints of valid inputs.</i></td></tr>
                        <tr><td colspan="4"><hr></td></tr>
                          <tr><td >Name:</td><td colspan="4"><input type=text title="First Name, Ex: Juan" name="fname" size="30"></input><input type=text title="Middle Name" name="mname" title="middle name" size="25"></input><input type="text" title="Last Name" name="sname" size="20"></input></td></tr>
                        <tr><td >Status:</td><td><select name="remarks"><?php foreach($status as $remarks){echo "<option value='".$remarks['code']."'>".$remarks['description']."</option>";} ?></select></td><td >Age:</td><td><input type="text" name="age" size="20"</input></td></tr>
                        <tr><td >Date of Birth:</td><td><input id="check_date" onblur="validate_date(this.value);" title="Format: mm-dd-yyyy; Ex: 12-12-2013" type="text" name="d_birth" size="40"></input></td>
                        <td >Gender:</td><td><input type="radio" name="gender" value="MALE" checked></input>MALE<input type="radio" name="gender" value="FEMALE"</input>FEMALE</td></tr>
                        <tr><td colspan="4"><hr></td></tr>
                        
                        <tr><td >Mailing Address:</td><td><input type="text" name="m_address" size="40"></input></td><td >CP Number:</td><td><input type="text" name="c_number" size="20"></input></td></tr>
                        <tr><td >Home Address:</td><td><input type="text" name="h_address" size="40"></input></td><td >Height(in):</td><td><input type="text" name="height" title="Express in f'in'': Example: 5'3''" size="20"></input></td></tr>
                        <tr><td >E-mail address</td><td><input type="text" name="e_address" size="40"></input></td><td >Weight(kgs):</td><td><input type=text name="weight" title="Express in kgs: Example: 55" size="20"></td></tr>
                        <tr><td >Nationality:</td><td><input type="text" name="nationality" size="40" value="FILIPINO"></input></td><td >Religion:</td><td><select name="religion" style="width: 13em"><option value="Roman Catholic">Roman Catholic</option><?php foreach($religion as $mao){echo "<option value='".$mao['description']."'>".$mao['description']."</option>";}?></select></td></tr>
                        <tr><td>Father's Name:</td><td><input type="text" name="f_name" size="40"></input></td><td>Occupation</td><td><input type="text" name="f_occupation" size="20"></input></td></tr>
                        <tr><td>Mother's Name:</td><td><input type="text" name="m_name" size="40"></input></td><td>Occupation</td><td><input type="text" name="m_occupation" size="20"></input></td></tr>
                        <tr><td>Guardian's Name:</td><td><input type="text" name="g_name" size="40"></input></td><td>Relationship</td><td><input type="text" name="relationship" size="20"></input></td></tr>    
                        <tr><td>First Choice:</td><td colspan="3"><center><select name="f_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option></center></td><td></td><td></td></tr>    
                        <tr><td>Second Choice:</td><td colspan="3"><center><select name="s_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option><center></td><td></td><td></td></tr>    
                        <tr><td>Third Choice:</td><td colspan="3"><center><select name="t_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option><center></td><td></td><td></td></tr>     
                        <tr><td>Action:</td><td colspan="4"><center><input type="reset"                style="width:200px;height:30px;font-weight:bolder;margin-left:20px;" value="Clear"></input>
                                            <input type="submit" disabled name="submit" id="agreement" style="width:200px;height:30px;font-weight:bolder;margin-left:20px;" value="Proceed to Course Choices"></input></center></td></tr>  
                    </table>                                                                                                                                                         
                    </form>
                    <center>
                     <table><tr><td><input id="note" onclick="agreement_status(this.checked);" type="checkbox"></input></td><td>This pre-registration is valid only upon official confirmation of the applicant by paying the the admission fee at Sorsogon State College office. </td> </tr></table>  
                    </center>
                     <?php 
    } */
    
     function admission_receipt_print($data){
       ?>

               <img src="icon/logo.jpg" alt="" id="logo" style="left:2.5in;position: fixed;">
               <table align="center">
                   <tr><td align="center">Sorsogon State College</td></tr>
                   <tr><td align="center">Magsaysay St., Sorsogon City</td></tr>
                </table>
                <BR>
       
       <table align="center">
            <tr><th align="center">ONLINE APPLICATION FOR ADMISSION</th></tr>
       </table>
       
             <table align="center"><tr><th style="font-style: italic;">Personal Information</th></tr></table>
             
<div id="enter_your_item_codes_security_here" style="left:2in;position: fixed;">

Enter codes

</div>

                    <table align="center">
              <tr><td>Name</td><td>:</td><td style="font-weight: bolder"><?php echo $data['name'];?></td></tr>
               <tr><td>Gender</td><td>:</td><td style="font-weight: bolder"><?php echo $data['name'];?></td></tr>
               <tr><td>Address</td><td>:</td><td style="font-weight: bolder"><?php echo $data['address'];?></td></tr>
               <td>Registration No</td><td>:</td><td style="font-weight: bolder"><?php echo $data['registration_no'];?></td></tr>
               <tr><td>Date of Registration</td><td>:</td><td style="font-weight: bolder"><?php echo $data['date_of_registration'];?></td></tr>
               <tr><td colspan="3"></td><td><hr></td></tr>
                </table>
                
                  <table align="center"><tr><th style="font-style: italic;">Course Options Details</th></tr></table>
              <table align="center">
              <tr><td>First Choice</td><td>:</td><td style="font-weight: bolder"><?php echo $data['first_choice'];?></td></tr>
               <tr><td>Second Choice</td><td>:</td><td style="font-weight: bolder"><?php echo $data['second_choice'];?></td></tr>
               <tr><td>Third Choice</td><td>:</td><td style="font-weight: bolder"><?php echo $data['third_choice'];?></td></tr>
               </table>
               
               
               <tr><td colspan="3"></td><td><hr style="border-bottom: 2px dotted #000; height: 0;"></td></tr>
                </table>
       
                                           

       <?php
     }   
     function log_profile($choices,$religion,$status){?>
                    <form name="form1" action="<?php echo "print_container.php";?>" method="POST">
                    <table border="0" align="left" style="margin-top:1em;;margin:1em 20% 0 20%;padding-left:2em;font-size: 13pt;font-family: 'Times New Roman', Times, serif;;">
                        <caption class="cog_etry">APPLICATION FOR ADMISSION CREDENTIALS</caption>
                        <tr><td colspan="4"><i>Please hover your mouse pointer on a specific field to provide you with hints of valid inputs.</i></td></tr>
                        <tr><td colspan="4" align="center"><hr></td></tr>
                        
                         <tr><td colspan="4" style="text-align: center;font-size: 20pt;color:black;background-color:#D8D8D8;">
                                <p style="text-align: left;margin-left: 3em">Personal/Required Information<img style="float:right;margin-bottom: 3pt;" src="icon/personal.jpg" alt=""></p>
                                
                                </td>
                             <td></td></tr>
                         
                        <tr><td><br></td></tr>
                        
                          <tr><td colspan="4">First Name:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type=text title="First Name, Ex: Juan" name="fname" size="60"></input></td></tr>
                          
                          <tr><td colspan="4">Middle Name: &nbsp<input type=text title="Middle Name" name="mname" title="middle name" size="60"></input></td></tr>
                          

                           <tr><td colspan="4">Last Name:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" title="Last Name" name="sname" size="60"></input></td></tr>
                    
                        <tr><td colspan="4">Age: &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                        <input type="text" name="age" size="20"</input></td></tr>
                       
                        <tr><td colspan="4">Date of Birth:&nbsp&nbsp&nbsp<input id="check_date" onblur="validate_date(this.value);" title="Format: mm-dd-yyyy; Ex: 12-12-2013" type="text" name="d_birth" size="40"></input></td></tr>
                                                
                        <tr><td >Gender:</td><td><input type="radio" name="gender" value="MALE" checked></input>MALE<input type="radio" name="gender" value="FEMALE"</input>FEMALE</td></tr>
                        
                       <tr><td >CP Number:</td><td>&nbsp&nbsp&nbsp&nbsp<input type="text" name="c_number" size="20"></input></td></tr>
                        
                         <tr><td colspan="4">Mailing Address:&nbsp&nbsp&nbsp<input type="text" name="m_address" size="45"></input></td></tr>
                         
                         <tr><td colspan="4">Home Address:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="h_address" size="45"></input></td></tr>
                        
                           <tr><td colspan="4">E-mail address:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="text" name="e_address" size="45"></input></td></tr>
                        
                        <tr><td >Status:</td><td>&nbsp&nbsp&nbsp&nbsp&nbsp<select name="remarks"><?php foreach($status as $remarks){echo "<option value='".$remarks['code']."'>".$remarks['description']."</option>";} ?></select></td></tr>
                        
                        <tr><td colspan="4"><hr></td></tr>
                        
                         <tr><td colspan="4" style="text-align: center;font-size: 20pt;color:black;background-color:#D8D8D8;">
                                <p style="text-align: left;margin-left: 3em">Relevant/Optional Information<img style="float:right;margin-bottom: 3pt;" src="icon/relevant.jpg" alt=""></p>
                                 </td>
                             <td></td></tr>
                         
                        <tr><td><br></td></tr>
                       
                        </tr><td >Height(in):</td><td><input type="text" name="height" title="Express in f'in'': Example: 5'3''" size="20"></input></td></tr>
                        
                     <tr><td >Weight(kgs):</td><td><input type=text name="weight" title="Express in kgs: Example: 55" size="20"></td></tr>
                     
                        <tr><td >Nationality:</td><td><input type="text" name="nationality" size="40" value="FILIPINO"></input></td></tr>
                        
                        <tr><td >Religion:</td><td><select name="religion" style="width: 13em"><option value="Roman Catholic">Roman Catholic</option><?php foreach($religion as $mao){echo "<option value='".$mao['description']."'>".$mao['description']."</option>";}?></select></td></tr>
                                                
                        <tr><td>Father's Name:</td><td><input type="text" name="f_name" size="40"></input></td><td>Occupation</td><td><input type="text" name="f_occupation" size="20"></input></td></tr>
                        
                        <tr><td>Mother's Name:</td><td><input type="text" name="m_name" size="40"></input></td><td>Occupation</td><td><input type="text" name="m_occupation" size="20"></input></td></tr>
                        
                        <tr><td>Guardian's Name:</td><td><input type="text" name="g_name" size="40"></input></td><td>Relationship</td><td><input type="text" name="relationship" size="20"></input></td></tr>    
                        
                        <tr><td colspan="4"><hr></td></tr>
                        
                        <tr><td colspan="4" style="text-align: center;font-size: 20pt;color:black;background-color:#D8D8D8;">
                                <p style="text-align: left;margin-left: 3em">Course Options<img style="float:right;margin-bottom: 3pt;" src="icon/career.jpg" alt=""></p>
                                
                                </td>
                             <td></td></tr>
                         
                        <tr><td><br></td></tr>
                        
                        
                        <tr><td colspan="4">First Choice:&nbsp&nbsp&nbsp&nbsp <select name="f_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option></td></tr> 
                     
                        <tr><td colspan="4"><br></td></tr>
                           
                        <tr><td colspan="4">Second Choice:&nbsp<select name="s_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option></td></tr>
                        
                         <tr><td colspan="4"><br></td></tr>    
                        <tr><td colspan="4">Third Choice:&nbsp&nbsp&nbsp&nbsp<select name="t_choice"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option></td></tr>   
                        
                         <tr><td colspan="4"><br><br></td></tr>
                            
                        
                    <tr><td colspan="4"><input id="note" onclick="agreement_status(this.checked);" type="checkbox"></input><i>This pre-registration is valid only upon official confirmation of the applicant by paying the the admission fee at Sorsogon State College office.</i></td></tr>
                    
                      <tr><td colspan="4"><br><br></td></tr>
                     <tr><td>Action:</td><td colspan="4"><center><input type="reset" style="width:200px;height:30px;font-weight:bolder;margin-left:20px;text-align: justify;" value="Clear"></input> <input type="submit" disabled name="submit" id="agreement" style="width:200px;height:30px;font-weight:bolder;margin-left:20px;" value="Confirm and Dowload Receipt"></input></center></td></tr>  
                      
                    </table>  
                                                                                                                                                                       
                    </form>

                     <?php 
    }
    
    function show_admission_profile($data){
                ?>
                <center>
                    <table width="80%" class="border_all">
                        <caption class="cog_etry">Applicants for Admission</caption>
                        <tr class="title"><td>Count</td><td>Name</td><td>Address</td><td>First Choice</td><td>Second Choice</td><td>Third Choice</td><td>Gender</td><td>Status</td></tr>
                        <?php
                        $count=1;
                        foreach($data as $profile){
                         ?>
                           <tr><td><?php echo $count?></td><td><?php echo $profile['name']?></td><td><?php echo $profile['h_address']?></td><td><?php echo admin_functions::replace_code_to_string($profile['f_choice']);?></td><td><?php echo admin_functions::replace_code_to_string($profile['s_choice'])?></td><td><?php echo admin_functions::replace_code_to_string($profile['t_choice']);?></td><td><?php echo $profile['gender'];?></td><td><?php echo admin_functions::replace_code_to_string_status($profile['remarks']);?></td></tr>
                         <?php   
                         $count++;
                        }?>
                    </table> 
                </center>               
                <?php
    }
    
    function entry_form_exam_new(){
         ?>
                <center>
                    <table class="cog_etry">
                    <caption class="cog_etry">New Exam</caption>
                              <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                             <tr><td>Exam Name</td><td><input type="text" name="exam_name"></input></td></tr>
                             <tr><td>No. of Items</td><td><input type="text" name="no_item"></input></td></tr>
                              <tr><td>No. of Choices</td><td><input type="text" name="no_choices"></input></td></tr>
                               <tr><td>Action</td><td>  <input type="submit" name="submit" value="ADD EXAM"></input> </td></tr>
                                                         
                    </table> 
                </center>               
                <?php
        
    }
    function add_items_exam($data){
               ?>
                <center>
                    <table class="cog_etry">
                    <caption class="cog_etry">Exam Names</caption>  
                    <?php foreach($data as $exam_name){ 
                    ?>                      
                        <tr><td>Exam Name</td><td><a href="main.php?page=admission&spec=addquestion&action=ask&subj=<?php echo $exam_name['code_exam'];?>"><?php echo $exam_name['name_exam'];?></a></td></tr> 
                       <?php }?>     
                    </table> 
                </center>               
                <?php
    } 
    
    function add_questions($exam){
        ?><table>
         <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
        <?php  
        $options = array("a","b","c","d","e","f");
        $count=1;
        foreach($exam as $questions){
            ?>
                 <tr><td><?php echo $count;?></td><td><textarea cols="150" rows="8" name="<?php echo "question_".$count?>"><?php echo $questions['main_q'];?></textarea> </td></tr>
                 <?php
                  foreach($options as $option){ 
                       if(is_null($questions['opt_'.$option])){ 
          
                       }elseif($questions['opt_'.$option]==""){
                           ?>
                            <tr><td><?php echo $option;?></td><td><input type="text" name="<?php echo $option."_".$count;?>"></input></td></tr>
                           <?php
                       }else{      
                             ?>
                             <tr><td><?php echo $option;?></td><td><input type="text" name="<?php echo $option."_".$count;?>" value="<?php echo $questions['opt_'.$option];?>"></input></td></tr>
                           <?php
                       }
                  }
                  ?>
                  <tr><td>Answer</td><td><select name="<?php echo "answer_".$count;?>">
                                            <?PHP   if($questions['cor_ans']==" " || $questions['cor_ans']==""){
                                                               ?>
                                                               <option value="<?php echo " "?>" selected><?php echo "--"?></option> 
                                                               <?php
                                                    }else{
                                                     ?>
                                                               <option value="<?php echo $questions['cor_ans'];?>" selected><?php echo $questions['cor_ans'];?></option> 
                                                               <?php
                                                     }    
                                      
                                                        foreach($options as $option){
                                                             if(is_null($questions['opt_'.$option])){
                                                                    #avoid non-existing choices 
                                                             }else{
                                                                ?>
                                                                 <option value="<?php echo $option?>"><?php echo $option?></option> 
                                                                <?php 
                                                             }           
                                                        }
                                                        ?>
                                                </select>
                  </td></tr>

                  <?php
                      $count++; //used as iterator 
        }
             ?>
              <tr><td>Action</td><td> <input type="submit" value="ADD ITEMS" name="submit"></input></td></tr>
              <input type="hidden" name="subj" value="<?php echo $_REQUEST['subj']; ?>"></input>
              <input type="hidden" name="count" value="<?php echo $count; ?>"></input>
        </table>
        <?php  

    }
    
    function show_exam_to_take($exam_name){
                 ?>
                <center>
                    <table>
                    <caption>Examination Subjects</caption>
                              <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                             <tr><td>Exam Name</td><td>
                                <select name="exam_name">
                                <?php
                                foreach($exam_name as $exam){
                                ?>
                                    <option value="<?php echo $exam['code_exam'];?>"><?php echo $exam['name_exam'];?></option>
                                <?php
                                    }
                                ?>
                                </select>
                             
                             </td></tr>
                                <tr><td>ID NO</td><td>  <input type="text" name="student_id"></input> </td></tr>

                               <tr><td>Action</td><td>  <input type="submit" name="submit" value="TAKE EXAM"></input> </td></tr>
                                                         
                    </table> 
                </center>               
                <?php
    }
    
    function render_questions($item,$student_id,$exam_name){
        $options = array("a","b","c","d","e","f");
        ?>
  <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
        <table>
        <?php
        $count=1;
            foreach($item as $items){
        ?>
            <input type="hidden" name="item_no[]" value="<?php echo $items['item_no']?>">
            
            <tr><td><?php echo $count.". ".$items['main_q']?></td></tr>
               <?php foreach($options as $option){
                        if(is_null($items['opt_'.$option])){
                            
                        }else{
                             ?>
                              <tr><td><input type="radio" name="<?php echo "ans_".$items['no']?>" value="<?php echo $option?>">
                                                                <?php echo $option.". ".$items['opt_'.$option];?></td></tr>                
                               <?php
                        }                    
                      }
                ?>
        
            <tr><td>&nbsp;</td></tr>
        <?php
        $count++;
            }
            ?>
            <input type="hidden" name="student_id" value="<?php echo $student_id;?>"></input>
            <input type="hidden" name="exam_name" value="<?php echo $exam_name;?>"></input>
             <input type="hidden" name="count" value="<?php echo $count;?>"></input>
            <tr><td><input type="submit" name="submit" value="DONE"></input></td></tr>
              </table>
              </form>
            <?php
    }
    
    function show_result_exam($names){
          ?>
          <center>
          <table width="75%" class="border_all">
            <caption class="cog_etry">Examination Result</caption>
            <tr class="title"><td>No</td><td>Student ID</td><td>Name</td><td>Score</td><td>Rating</td><td>Remarks</td></tr>
            <?php
            $count=1;
            foreach($names as $name){
                ?>
               <tr><td><?php echo $count;?></td><td><?php echo $name['student_id'];?></td><td><?php echo $name['name'];?></td><td><?php echo $name['score'];?></td><td><?php echo $name['rating']?></td><td><?php echo $name['remarks'];?></td></tr>  
                <?php
                $count++;
            }
            ?>
          </table>
          </center>
          <?php
    }
               
}

class accounting_forms{
    
    function ar_report_onpage($row,$submitted){
        ?>
            <center>
           
            <table class="border_all">
                 <caption class="cog_etry">Accounts Receivable Report<br><?php echo "AS OF ".strtoupper(date("F").date("d").", ".date("Y"));?></caption>
            <tr class="title"><td>No</td><td>Name of Debtor</td><td>Amount Balance</td><td>Less than 90 days</td><td>91-365 days</td><td>Over  1 year</td><td>Over  2 years</td><td>Remarks</td></tr>
                <?php
            $count=1;
            foreach($row as $name){
                ?>
               <tr><td><?php echo $count;?></td><td><?php echo $name['name'];?></td><td><?php echo $name['amount'];?></td>
               <?php 
                    #conditional statement for the three columns
                    if($name['deperencia']<=90){
                        ?><td><?php echo $name['amount'];?></td><td></td><td></td><td></td><?php
                    }elseif($name['deperencia']>90 && $name['deperencia']<=365){
                        ?><td></td><td><?php echo $name['amount'];?></td><td></td><td></td><?php
                    }elseif($name['deperencia']>365 && $name['deperencia']<=730){
                         ?><td></td><td></td><td><?php echo $name['amount'];?></td><td></td><?php
                    }else{
                         ?><td></td><td></td><td></td><td><?php echo $name['amount'];?></td><?php
                    }
               ?>
             <td><?php $semester =  $name['semester']==1?"1st":"2nd";
                        echo $semester." Sem ".$_SESSION['syear']."-".($_SESSION['syear'] + 1);
             ?></td></tr>  
                <?php
                $count++;
            }
            ?>    
                
            </table>
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                <input type="submit" name="submit" align="center" value="Download AR Report"></input>   
                <input type="hidden" name="month" value="<?php echo $submitted['month'];?>">
                <input type="hidden" name="day" value="<?php echo $submitted['day'];?>">
                <input type="hidden" name="year" value="<?php echo $submitted['year'];?>">
                <input type="hidden" name="degreename" value="<?php echo $submitted['degreename'];?>">
             </form>
            </center>
        <?php
    }
    
    function account_receivables_report($month,$courses){
         ?>
                <center>
                <table class="cog_etry">
                <caption class="cog_etry">Accounts Receivable Report</caption>
                <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">                
             <center>
             <table>
             
         <!--     <tr><td>Year Level</td><td><select name="yr_lvl">
                            <option value="1">First</option><option value="2">Second</option>
                            <option value="3">Third</option><option value="4">Fourth</option>
                            <option value="5">Fifth</option></td></tr>   </select></td></tr> -->
               
             <tr><td>Date</td><td>
                <select name="month">
                    <option value="<?php echo date('m');?>"><?php echo date('F');?></option>
                    <?php foreach($month as $key=>$bulan){echo "<option value='".sprintf("%02d",$key)."'>".$bulan."</option>";}?></select>
                    
                 <select name="day">
                    <option value="<?php echo date('d');?>"><?php echo date('d');?></option>
                    <?php for($i=1;$i<=31;$i++){echo "<option value='".sprintf("%02d",$i)."'>".sprintf("%02d",$i)."</option>";}?></select>
                 
                 <input maxlength="4" name="year" type="text" value="<?php echo date('Y');?>"></input>
                </td>
             </tr>
             
             <tr><td>Degree</td><td><select name="degreename">
                                    <?php foreach($courses as $course){
                                            ?><option value="<?php echo $course['degreecode']."-".$course['major'];?>"><?php echo $course['degreename'];?></option><?php
                                    }?></select></td></tr>               
             </table>
             <input name="submit" type="submit" value="Generate AR Report"></input>
             </center> 
             </form>
                </table>
                </center>
                <?php
    }
    
     function create_account(){
             ?>
                <center>
                <table class="cog_etry">
                <caption class="cog_etry">Create New Account</caption>
                    <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                        <tr><td>ID No</td><td><input type="text" name="id_no"></input></td></tr>   
                        <tr> <td>Account Name</td> <td><input type="text" name="account_name"></input></td></tr>
                        <tr><td></td></tr>
                        <tr> <td>Department</td> <td><input type="text" name="department"></input></td></tr>
                        <tr><td></td></tr>
                         <tr><td>Action</td> <td><input type="submit" name="submit" value="Create Account"></td>
                    </form>    
                </table>
                </center>
                <?php
     }
     function entry_form_assessment($data){
                ?>
      <center>          
        <table class="cog_etry">
            <caption class="cog_etry">Accounting Assessment Form</caption>
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                 <tr> <td>ID No</td> <td><input type="text" name="student_id"></input></td>
                <tr><td>Year Level</td><td><select name="yr_lvl">
                            <option value="1">First</option><option value="2">Second</option>
                            <option value="3">Third</option><option value="4">Fourth</option>
                            <option value="5">Fifth</option></td></tr>   </select>
                <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                 <?php if($data=="assess"){?>
                            <tr> <td>Action</td> <td><input type="submit" name="submit" value="Enrollment Balance"></td>
                        <?php }else{
                            ?>
                            <tr> <td>Action</td> <td><input type="submit" name="submit" value="Other Fees Balance"></td>
                <!--           <input type="hidden" name="assess_id" value="0"></input>
                            <input type="hidden" name="assess_name" value="Certification fee" readonly></input> -->
                            <?php
                        }   
                            ?>                            
            </form>   
        </table>
       </center> 
        <?php
         }
         
          function show_current_balance($assessment,$student_id,$yr_lvl,$semester){
             ?>
               <form name="form1"  action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST" id="accounting_assess"> 
                <table class="listings" >
                                <tr><th>Assessment</th><th>Amount</th></tr>
                                <input type="hidden" name="student_id" value="<?php echo $student_id;?>"></input>
                                 <input type="hidden" name="yr_lvl" value="<?php echo $yr_lvl;?>""></input>
                                  <input type="hidden" name="semester" value="<?php echo $semester;?>""></input>
                                <?php
                                #declare counter for total
                                $total_assess = 0;
                                    foreach($assessment as $babayaran){
                                        #get the value of tuition
     
                                        ?>
                                           <input type="hidden" name="descr_<?php echo $babayaran['assess_id'];?>" value="<?php echo $babayaran['assess_name']?>"

                                           <tr>
                                               <td><input type="checkbox" class="assessment" id="<?php if($babayaran['assess_id']=="0"){echo "tuition_fee";}?>" onclick="account_assess();" checked="true"  value="<?php echo $babayaran['amount'];?>"><?php echo $babayaran['assess_name'];;?></input></td>
                                               <input type="hidden" name="assess_id[]" value="<?php echo $babayaran['assess_id'];?>"></input>
                                               <td><input type="text"  onchange="change_tuition();" <?php if($babayaran['assess_id']<>"0"){echo "readonly ";}?>name="amount_<?php echo $babayaran['assess_id'];?>" id="<?php if($babayaran['assess_id']=="0"){echo "tuition_fee_form";}?>" onclick="account_assess();" value="<?php echo $babayaran['amount'];?>"></input></td>
                                           </tr>
                                        <?php
                                        if($babayaran['assess_id']=="0"){
                                            $total=$total+$babayaran['amount'];
                                        }else{
                                            $total=$babayaran['amount'] + $total;
                                        }
                                    }
                                    ?>                             
                                 <tr><td>Total Amount</td> <td id="result_assess"><?php echo sprintf("%.2f",$total);?></td></tr>
                                  <tr><td>Assessment No</td> <td><input type="text" name="assess_no"></input></td></tr>
                                 <tr><td>Action</td> <td><input type="submit" name="submit" value="ASSESS"></input></td></tr>
                              </table>
                              </form>
                              <?php    
         }
         
          function view_form_balance(){
                ?>
                <center>
                <table class="cog_etry">
                <caption class="cog_etry">Collectibles Form</caption>
                    <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                        <tr><td>Year Level</td><td><select name="yr_lvl">
                                    <option value="1">First</option><option value="2">Second</option>
                                    <option value="3">Third</option><option value="4">Fourth</option>
                                    <option value="5">Fifth</option></td></tr>   </select>
                        <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                         <tr> <td>Action</td> <td><input type="submit" name="submit" value="Show List"></td>
                    </form>    
                </table>
                </center>
                <?php
         }
         
         function view_collection(){
              ?><center>
                <table class="cog_etry">
                    <caption class="cog_etry">Collection Form</caption>
                    <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                        <tr><td>Year Level</td><td><select name="yr_lvl">
                                    <option value="1">First</option><option value="2">Second</option>
                                    <option value="3">Third</option><option value="4">Fourth</option>
                                    <option value="5">Fifth</option></td></tr>   </select>
                        <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                         <tr> <td>Action</td> <td><input type="submit" name="submit" value="Show Collection"></td>
                    </form>    
                </table>
                </center>
                <?php
             
         }
         
         function show_balances($set){
             ?>
             <center>
             <table width="50%" border="1" class="listings">
                <caption class="cog_etry">Collectibles Account</caption>
             <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                <tr><th>Student Id</th><th>Assess NO</th><th>Balance</th></tr>
             <?php
             $count=0;
             $total=0;
             foreach($set as $data){
             $count++;
             ?>
             <tr><td><?php echo $data['student_id'];?></td><td><?php echo $data['assess_no']?></td><td style="text-align: right"><?php echo sprintf("%.2f",$data['balance']);?></td></tr>  
               <?php
              $total=$total + $data['balance'];
             }
               ?>
               <tr><td><?php echo $count;?></td><td><?php echo $count;?></td><td style="text-align: right"><?php echo sprintf("%.2f",$total);?></td></tr>
            </form>    
        </table>
        </center>
         <?php
         }
         
          function show_collection($set){
             ?>
             <center>
             <table width="50%" border="1" class="listings">
                <caption class="cog_etry">Collection Account</caption>
             <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                <tr><th>Student Id</th><th>Assess No</th><th>OR NO</th><th>Balance</th></tr>
             <?php
             $count=0;
             $total=0;
             foreach($set as $data){
             $count++;
             ?>
             <tr><td><?php echo $data['student_id'];?></td><td><?php echo $data['assess_no']?></td><td><?php echo $data['or_number']?><td style="text-align: right"><?php echo $data['amount'];?></td></tr>  
               <?php
              $total=$total + $data['amount'];
             }
               ?>
               <tr><td><?php echo $count;?></td><td><?php echo $count;?></td><td><?php echo $count;?></td><td style="text-align: right"><?php echo sprintf("%.2f",$total);?></td></tr>
            </form>    
        </table>
        </center>
         <?php
         }
         
         function show_other_fees_balance($babayaran,$student_id,$yr_lvl,$semester){
             ?>
             <center>
                <table class="listings">
                    <caption class="cog_etry">Assessment of Other Fees</caption>        
                      <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST" id="accounting_assess">      
                        <tr><th>Assessment Name</th><th>Amount</th></tr>
                        <?php
                            $amount=0;                    
                             foreach($babayaran as $assess){
                            ?>
                            <input type="hidden" name="descr_<?php echo $assess['assess_id'];?>" value="<?php echo $assess['assess_name'];?>">
                            <tr><td><input type="checkbox" checked onclick="account_assess();" class="assessment" value="<?php echo $assess['amount'];?>"><?php echo $assess['assess_name'];?></input>
                                     <input type="hidden" name="assess_id[]" value="<?php echo $assess['assess_id'];?>"></input> 
                            </td><td><input readonly type="text" name="amount_<?php echo $assess['assess_id']?>" value="<?php echo $assess['amount'];?>"></input></td></tr>
                            <?php
                            $amount = $amount + $assess['amount'];
                        }?>
                          <tr><td>Total</td><td id="result_assess"><?php echo sprintf("%.2f",$amount);?></td></tr>
                   </table>
                   <table class="cog_etry">                      
                       <tr><td>Assess No</td><td><input type="text" name="assess_no"></input></td></tr>     
                        <tr><td>Action</td><td> <input type="submit" name="submit" value="Assess Other Fees"></input></td></tr>    
                    </table> 
                        <input type="hidden" name="total" id ="result_assess_hidden" value="<?php echo $amount;?>"></input>  
                        <input type="hidden" name="yr_lvl" value="<?php echo $yr_lvl;?>">
                        <input type="hidden" name="semester" value="<?php echo $semester;?>">
                        <input type="hidden" name="student_id" value="<?php echo $student_id;?>">
                    </form>
             </center>
             <?php
   
             
             
         }
         
}

class admin_forms{
    public function add_user($user_type){ 
        $_SESSION['page']="Add Users";
        ?>
      <center> 
        <table class="cog_etry">
           <caption class="cog_etry">Add Users Form</caption>      
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"> 
                <tr><td>Username</td>   <td><input type="text" name="username"></input></td></tr>
                <tr><td>Password</td>   <td><input type="password" name="password"></input></td></tr>
                <tr><td>User Type</td>  <td><select name="user_type">
                                             <?php foreach($user_type as $option){
                                                 echo "<option value=".$option['code'].">".$option['description']."</option>";
                                             }?>       
                                            </select></td></tr>
                <tr><td>Name</td><td><input type="text" name="fullname"></input></td></tr>
                <tr><td>Profile ID</td><td><input type="text" name="profile_id"></input></td></tr>
                <tr><td>Position</td><td><input type="text" name="position"></input></td></tr>
                <tr><td>Phone</td><td><input type="text" name="phone"></input></td></tr>
                <tr><td>Email Address</td><td><input type="text" name="email"></input></td></tr> 
                <tr><td>Action</td><td><input type="submit" name="submit" value="Add User"></td></tr>
            </form>
        </table>
       </center>  
        <?php
    }
    
    public function edit_user($user_type,$profile){
        $_SESSION['page']="Edit Users";
            ?>
       <center>     
        <table>
            <caption class="cog_etry">Users List</caption>
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
            <input type="hidden" name="old_username" value="<?php echo $profile[0]['username'];?>"></input> 
                <tr><td>Username</td>   <td><input type="text" name="username" value="<?php echo $profile[0]['username'];?>"></input></td></tr>
                <tr><td>Password</td>   <td><input type="password" name="password"></input></td></tr>
                <tr><td>User Type</td>  <td><select name="user_type">
                                             <?php foreach($user_type as $option){
                                                 if($option['code']==$profile[0]['user_type']){
                                                   echo "<option value=".$option['code']." selected>".$option['description']."</option>";   
                                                 }else{
                                                     echo "<option value=".$option['code'].">".$option['description']."</option>"; 
                                                 }
                                                 echo "<option value=".$option['code'].">".$option['description']."</option>";
                                             }?>       
                                            </select></td></tr>
                <tr><td>Name</td><td><input type="text" name="fullname" value="<?php echo $profile[0]['name'];?>"></input></td></tr>
                <tr><td>Position</td><td><input type="text" name="position" value="<?php echo $profile[0]['positions'];?>"></input></td></tr>
                <tr><td>Phone</td><td><input type="text" name="phone" value="<?php echo $profile[0]['phone'];?>"></input></td></tr>
                <tr><td>Profile ID</td><td><input type="text" name="profile_id" value="<?php echo $profile[0]['profile_id'];?>"></input></td></tr>
                <tr><td>Email Address</td><td><input type="text" name="email" value="<?php echo $profile[0]['email'];?>"></input></td></tr> 
                <tr><td>Action</td><td><input type="submit" name="submit" value="Update User"></td></tr>
            </form>
        </table>
       </center> 
        <?php
    }
    
    public function view($row){
        $_SESSION['page']="Edit/Delete Users";
        #this function shows all the users for possible deletion and edit?>
    <center>
        <table align="center" width="80%">
            <caption class="cog_etry">List of Users</caption>       
            <tr><td colspan="7"><hr></td></tr>
            <tr>
                <td align="center">Delete</td>
                <td align="center">Edit</td>
                <td align="center">Full Name</td>
                <td  align="center">Position</td>
                <td align="center">User Name</td>
                <td align="center">Profile Id</td> 
                <td align="center">Phone</td>
                <td align="center">Email</td>
            </tr>
              <tr><td colspan="7"><hr></td></tr>
        <?php
      foreach($row as $data){
            ?>
            <tr>
                <!--icon here for delete!-->
                <td align="center"><a href="main.php?page=admin&spec=delete&action=ask&username=<?php echo $data['username']?>" title="delete user"><img src="icon/icon_del.jpg"></a></td>
                <!--icon here for delete!-->
                <td align="center"><a href="main.php?page=admin&spec=edit&action=ask&username=<?php echo $data['username']?>" title="edit user"><img src="icon/icon_edit.jpg"></a></td>
                <td><?php echo $data['name']?></td>
                 <td><?php echo $data['position']?></td>
                  <td><?php echo $data['username']?></td>
                   <td><?php echo $data['profile_id']?></td>  
                   <td><?php echo $data['phone']?></td> 
                   <td><?php echo $data['email']?></td>     
            </tr>
            <?php }?> </table>  </center>    
            <?php
        
    }
    
    public function assessment_names($assessment){
        ?>
        <table class="listings">
            <tr>
              <th colspan="2">Fees</th>                 <th colspan="5">Amounts</th>  
            </tr>
            <tr>  
              <th>No<th>Assessment Description</th><th>1st Year</th><th>2nd Year</th><th>3rd Year</th><th>4th Year</th><th>5th Year</th>
            </tr>
        
            <form name="form1" id="subjects_assess" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
       <?php     
       $count=1;
       foreach($assessment as $to_show){  ?>
               <tr> <input type="hidden" name="descr_<?php echo $to_show['AssessmentID']?>" value="<?php echo $to_show['AssessmentName']?>"></input>
               <th><input   type="checkbox" name="total_assessment[]" value="<?php echo $to_show['AssessmentID'];?>"><?php //echo $count;?></input></th>
                   <td><?php echo $to_show['AssessmentName']?></td>
                   <td><input type="text" name="first_<?php echo $to_show['AssessmentID'];?>"></input></td>
                   <td><input type="text" name="second_<?php echo $to_show['AssessmentID'];?>"></input></td>
                   <td><input type="text" name="third_<?php echo $to_show['AssessmentID'];?>"></input></td>
                   <td><input type="text" name="fourth_<?php echo $to_show['AssessmentID'];?>"></input></td>
                   <td><input type="text" name="fifth_<?php echo $to_show['AssessmentID'];?>"></input></td>
               </tr>
        <?php $count++;
       }?>
        <tr><td colspan="2">Semester</td><td colspan="5"><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
        <tr><td colspan="2">Action</td><td colspan="5"><input style="width:20em" type="submit" name="submit" value="Apply Configuration"</td></tr>
         </table> 
         </form>
         <?php
       
    }
    
    public function settings_config($syear){
        $_SESSION['page']="Settings Override";
        ?>
        <center>
        <table class="cog_etry">
            <caption class="cog_etry">Settings Configuration</caption>
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
            <tr><td>S.Y</td><td><select name="syear"><?php 
                                         echo "<option selected value='".date('Y')."'>".date('Y')."-".(date('Y')+1)."</option>";
                                foreach($syear as $pasukan){
                                            $susi = key($pasukan);                                             
                                            echo "<option value='".$susi."'>".$pasukan[$susi]."</option>";}?></select></td></tr>
            <tr><td>Action</td><td><input type="submit" name="submit" value="Apply Settings"></td></tr>
            </form>
         </table>   
           </center>
        <?php
    }
    
}
class cashier_forms{
    
        function change_or(){
             ?>
            <center>
               <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
             <table class="cog_etry">
                <caption class="cog_etry">Change OR NUmber Settings</caption>
                    <tr><td>Start of OR</td><td><input type="text" name="start_or"></input></td></tr>
                     <tr><td>End of OR</td><td><input type="text" name="end_or"></input></td></tr>
                     <tr><td>Action</td><td><input type="submit" name="submit" value="Change OR"></input></td></tr>
             </table>
            </form>
            </center>
            <?php
        }    
    
        function process_print_receipt($student_id,$assess_no){
            ?>
            <center>
            <h3 style="text-align: center;">Continue to print?</h3>
            <form action="print_container.php" method="POST">
            <table><tr><td><input type="radio" name="print" value="yes">YES</input></td><td><input type="radio" name="print" value="no">NO</input></td></tr>
            <tr><td colspan="2"><input type="submit" name="submit" value="PRINT RECEIPT"></input></td></tr>
            </table>
            <input type="hidden" name="student_id" value="<?php echo $student_id;?>"></input>
            <input type="hidden" name="assess_no" value="<?php echo $assess_no;?>"></input>
            </form>
            </center>
            <?php
        }    
    
         function general_collection_summary($data,$adlaw){
             ?>
             <center>
                <table class="border_all" width="50%">
                    <caption class="cog_etry">
                        General Summary of Collection
                    </caption>
                        <tr class="title"><td>No<td>Assess Name</td><td>Amount</td></tr>
                        <?php
                        $count=0; 
                        $total = 0;
                        foreach($data as $summary){
                            $count++;
                            ?>
                            <tr><td><?php echo $count;?></td><td><?php echo $summary['assess_name'];?></td><td style="text-align: right;"><?php echo sprintf("%.2f",$summary['amount']);?></td></tr>
                            <?php
                        $total = $total + $summary['amount'];
                        }
                        ?>
                        <tr><td>Total</td><td><?php echo $count;?></td><td style="text-align: right;"><?php echo sprintf("%.2f",$total);?></td></tr>
               <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
               <input type="hidden" name="type_report" value="general"></input>
                </table>
                <input type="hidden" name="adlaw" value="<?php echo $adlaw;?>"></input>
                  <input style="margin-top: 2em;" name="submit" type="submit" value="DOWNLOAD COLLECTION"></input>
               </form>
             </center>
             <?php
         }      
         function entry_form_balances(){
                ?>
        <table>
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                <tr><td>Year Level</td><td><select name="yr_lvl">
                            <option value="1">First</option><option value="2">Second</option>
                            <option value="3">Third</option><option value="4">Fourth</option>
                            <option value="5">Fifth</option></td></tr>   </select>
                <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                 <tr> <td>Action</td> <td><input type="submit" name="submit" value="Show Balance"></td>
            </form>    
        </table>
        <?php
         }
         
         function process_bayad(){
                ?>
           <center>   
                <table class="cog_etry">
                    <caption class="cog_etry">Cashier Payment Form</caption>
                    <form name="form1" action="<?php echo "print_container.php";?>" method="POST">
                        <tr> <td>ID Number</td> <td><input type="text" name="student_id"></input></td></tr>
                        <tr> <td>Assessment No</td> <td><input type="text" name="assess_no"></input></td></tr>
                        <tr> <td>Current OR No</td> <td><input readonly type="text" name="" value="<?php echo $_SESSION['start_or'];?>"></input></td></tr>
                         <tr> <td>Action</td> <td><input type="submit" name="submit" value="Process Payment"></td>
                    </form>    
                </table>
            </center>  
            <?php
         }
         
         function babayaran($data,$name,$student_id,$assess_no){
             ?> 
       <!--      <table style="position:absolute;left: 1.5in;top: 2.2in; text-align: left;"> -->
        <form name="form1" action="<?php echo "main.php";?>" method="POST" onsubmit="cashier_print();">
       <p style="position: absolute;left:1.9in;top:1.0in;font-size: 14pt;line-height: 1.5pt"><em id="invisible">No <input style="border: none;" type="text" name="or_no" value="<?php echo $_SESSION['start_or'];?>" style="color:red;"></input></em><br>
       <span style="font-size: 12pt"> <?php echo date("m/d/Y");?></span>
       </p>
       <br>
             <p style="position:absolute;top:1.22in;text-align: left;left:0.7in;line-height: 1.5em;">SSC-Sorsogon</br>
             <?php echo strtoupper($name);?></p>
             
                 <table class="listings" style="width:3.2in;position: absolute;top:2.15in;">
              
                <input type="hidden" name="student_id" value="<?php echo $student_id;?>"></input>
                 <input type="hidden" name="assess_no" value="<?php echo $assess_no;?>"></input>
                 <input type="hidden" name="assess_date" value="<?php echo $data[0]['accounting_date'];?>"></input>
                  <input type="hidden" name="yr_lvl" value="<?php echo $data[0]['yr_lvl'];?>"></input>
                   <input type="hidden" name="semester" value="<?php echo $data[0]['semester'];?>"></input> 
               
            <tr id="mawawara_title"><th>Nature of Collection</th><th>Amount</th></tr>
               <?php 
               $miscellanoues=0;
               $total = 0;
               $assess=0;
               foreach($data as $bayadan){
                   ?>
                   <!-- this is used to record names only-->
                   <input type="hidden" name="assess_name[]" value="<?php echo $bayadan['assess_name'];?>"></input>
                     <!-- this is used to record names only-->    
                     <?php if($bayadan['assess_id']==0 || $bayadan['assess_id']==16 || $bayadan['assess_id']==23){//this is used to consolidate the miscellaneous fee
                         ?>
                           <tr style="height: 0.8em;"><td><b><?php echo $bayadan['assess_name'];?></b></td>
               <!--    <td style="text-align: right"><?php echo $bayadan['amount'];?></td> -->
                   <td style="text-align: right"><b><?php echo $bayadan['accounting_amount'];?></b></td></tr>
                         <?php
                     }else{
                             $miscellanoues = $miscellanoues + $bayadan['amount'];
                     }    
                     
               $total = $total + $bayadan['amount'];
               $assess = $assess + $bayadan['accounting_amount'];
               }
               #prepare the format
               $assess = sprintf("%.2f",$assess);
               $total =   sprintf("%.2f",$total);
                ?>    
             <tr><td><?php echo "Miscellanous Fee";?></td>
               <!--    <td style="text-align: right"><?php echo $bayadan['amount'];?></td> -->
                   <td style="text-align: right"><?php echo sprintf("%.2f",$miscellanoues);?></td></tr>
               
               <tr id="mawawara_total">   <th>Total Amount</th>
        <!--       <th style="text-align: right"><?php echo $total;?></th> -->
               <th style="text-align: right"><?php echo $assess;?></th>  </tr>    
            </table>
            <p style="display: none; position:absolute;left:3.0in;top:3.1in;text-align: left;font-weight: bolder;" id="amo_total"><?php echo $assess;?></p>
            <table class="cog_etry">
               <tr id="mawawara_button"><td></td><td><input type="submit" style="position:absolute;top:5.0in;left:2.0in" name="submit" value="Paid"></input></td><td></td></tr>
               <input  type="hidden" name="amount" value="<?php echo $assess;?>"></input>
                </form>            
            </table>
            <p id="amo_words" style="display: none; text-align: left;position: absolute;left:1.2in;top:3.3in"><?php echo $barya = admin_functions::change_to_words($assess);?></p>
            <p style="text-align: center;position: absolute;top:4.4in;left:1.35in"><b>MARILOU G. AGNOTE</b></p>
   
             <?php
         }
         
         function collectibles_entry($month,$action=NULL){
             admin_functions::mga_konstant($action);
             ?>
             <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
             <center>
             <table>
                <caption class="cog_etry"><?php echo defined('titulo')?titulo:"Itemized Collection Report";?></caption>
             <tr><td>Date</td><td>
                <select name="month">
                    <option value="<?php echo date('m');?>"><?php echo date('F');?></option>
                    <?php foreach($month as $key=>$bulan){echo "<option value='".sprintf("%02d",$key)."'>".$bulan."</option>";}?></select>
                    
                 <select name="day">
                    <option value="<?php echo date('d');?>"><?php echo date('d');?></option>
                    <?php for($i=1;$i<=31;$i++){echo "<option value='".sprintf("%02d",$i)."'>".sprintf("%02d",$i)."</option>";}?></select>
                 
                 <input maxlength="4" name="year" type="text" value="<?php echo date('Y');?>"></input>
                </td>
             </tr>
             </table>
             <input name="submit" type="submit" value="View DAY COLLECTION"></input>
             <?php 
             #this is used to specify whether general of itemized
             if(defined('objective')){
                 echo objective;
                 }?>
             </center>
             </form>
             <?php
         }
         
         function collectibles_complete_view($record,$needed){
              ?>
              <center>
              <P style="font-size: 14px;font-weight: bold;">REPORT OF COLLECTION<br>
             SORSOGON STATE COLLEGE<br>
             SORSOGON CITY CAMPUS<br>
             SORSOGON CITY<br>
              <BR>
              UNDERGRADUATE</p>
                <table class="border_all" width="90%">
                    <tr class="title">
                        <td>OR NO</td><td>PAYOR</td><td>COURSE/YEAR</td><td>PARTICULARS</td><td>AMOUNT</td><td>DATE ASSESSED</td><td>ASSESS NO</td><td>Amount</td>
                    </tr>
                    <?php foreach($record as $data){ ?>
                    <tr>
                        <td><?php echo $data['or_number'];?></td><td><?php echo $data['name'];?></td><td><?php echo $data['course'];?></td>
                        <td><?php echo $data['assess_name'];?></td><td style="text-align: right"><?php echo $data['amount'];?></td><td style="text-align: right"><?php echo $data['assess_date'];?></td>
                        <td style="text-align: right"><?php echo $data['assess_no'];?></td><td style="text-align: right"><?php echo $data['amount'];?></td>
                    </tr>
                     <?php }?>
                </table>
                   <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                   
                       <input name="month" value="<?php echo $needed['month'];?>" type="hidden"></input>
                       <input name="day" value="<?php echo $needed['day'];?>" type="hidden"></input>
                       <input name="year" value="<?php echo $needed['year'];?>" type="hidden"></input> 
                       <br>
                       <input type="submit" name="submit" value="DOWNLOAD COLLECTION"></input>
                   </form>
              </center>
              <?php
             
         }
}

class dean_forms{
    
    function grade_entry(){
        $_SESSION['page']="Grade Entry";
        ?>
           <center>   
                <table class="cog_etry">
                    <caption class="cog_etry">Grade Entry Form</caption>
                    <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                        <tr> <td>ID Number</td> <td><input type="text" name="student_id"></input></td></tr>
                        <tr><td>Year Level</td><td><select name="yr_lvl">
                            <option value="1">First</option><option value="2">Second</option>
                            <option value="3">Third</option><option value="4">Fourth</option>
                            <option value="5">Fifth</option></td></tr>   </select>
                <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                         <tr> <td>Action</td> <td><input type="submit" name="submit" value="<?php echo "Enter Grades";?>"></td>
                    </form>    
                </table>
            </center>  
            <?php
    }
    
    function grade_update_form($data,$profile){
        ?>
        <center>
           <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
            <input  name="yr_lvl" type="hidden" value="<?php echo $profile['yr_lvl'];?>"></input>
              <input name="semester" type="hidden"  value="<?php echo $profile['semester'];?>"></input>
               <input name="student_id" type="hidden"  value="<?php echo $profile['student_id'];?>"></input>
               
            <table class="border_all">
                <caption class="cog_etry"><?php echo "Grades for ( Year Level: ".$profile['yr_lvl']." Semester: ".$profile['semester'].")";?></caption>
                    <tr class="title"><td>Subject Code</td><td>Description</td><td>Pre-requisite</td><td>Units</td><td>Grade</td><td>Remarks</td></tr>
                       
                        <?php
                        foreach($data as $grade){
                    ?><input type="hidden" name="subj_code[]" value="<?php echo $grade['subj_code'];?>"></input>
                        <tr><td><?php echo $grade['subj_code']?></td><td><?php echo $grade['description']?></td>
                        <td><?php echo $grade['subj_preq'];?></td>
                        <td><?php echo $grade['units']?></td>
                        <td><input type="text" name="grade_<?php echo $grade['subj_code'];?>" onblur="check_num(this.value);" value="<?php echo $grade['grade_1']?>" style="width: 5em;"></input></td>
                        <td>
                            <select name="stat_<?php echo $grade['subj_code'];?>">
                                    <option value="<?php echo $grade['status']?>"><?php echo $grade['status']?></option>
                                      <option value=""></option>
                                  <option value="dropped">Dropped</option>
                                  <option value="failed">Failed</option>
                                <option value="inc">Incomplete</option>
                                <option value="passed">Passed</option>
                            </select>
                        </td></tr>
                    <?php    
                        }      
                        ?>           
            </table>
            <br>
            <input name="submit" type="submit" value="Update Student Grade"></input>
                </form>   
        </center>
        <?php
    }
    
    function assess_student(){
        $_SESSION['page']="Evaluation of Subjects";
         ?>
           <center>   
                <table class="cog_etry">
                    <caption class="cog_etry">Evaluate Student's Subjects</caption>
                    <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                        <tr> <td>ID Number</td> <td><input type="text" name="student_id"></input></td></tr>
                        <tr><td>Year Level</td><td><select name="yr_lvl">
                            <option value="1">First</option><option value="2">Second</option>
                            <option value="3">Third</option><option value="4">Fourth</option>
                            <option value="5">Fifth</option></td></tr>   </select>
                <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
                         <tr> <td>Action</td> <td><input type="submit" name="submit" value="Evaluate Subjects"></td>
                    </form>    
                </table>
            </center>  
            <?php
    } 
    
    function section_form($section,$month){
        $_SESSION['page']="Section Assignment";
         ?>
           <center>   
                <table class="cog_etry">
                    <caption class="cog_etry">Section Assignment</caption>
                    <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
                        <tr> <td>ID Number</td> <td><input type="text" name="student_id"></input></td></tr>
                        <tr><td>Year Level</td><td><select name="yr_lvl">
                            <option value="1">First</option><option value="2">Second</option>
                            <option value="3">Third</option><option value="4">Fourth</option>
                            <option value="5">Fifth</option></td></tr>   </select>
                <tr> <td>Semester</td> <td><select name="semester"><option value="1">First</option><option value="2">Second</option></select></td></tr>
         <tr>      
            <td>Section</td>
            <td>
          <select name="section">
                    <option value=""><?php echo " "?></option>
                    <?php
                        foreach($section as $isesection){
                            echo "<option value='".$isesection['code']."'>".$isesection['code']."</option>";
                        }
                     ?> 
                </select>
               </td>  
           </tr> 
           <tr>
            <td>Date of Registration</td>
            <td> <select name="month">
                    <option value="<?php echo date('m');?>"><?php echo date('F');?></option>
                    <?php foreach($month as $key=>$bulan){echo "<option value='".sprintf("%02d",$key)."'>".$bulan."</option>";}?></select>
                    
                 <select name="day">
                    <option value="<?php echo date('d');?>"><?php echo date('d');?></option>
                    <?php for($i=1;$i<=31;$i++){echo "<option value='".sprintf("%02d",$i)."'>".sprintf("%02d",$i)."</option>";}?></select>
                 
                 <input maxlength="4" name="year" type="text" style="width:3em;" value="<?php echo date('Y');?>"></input>
                </td>
            
           </tr>       
                         <tr> <td>Action</td> <td><input type="submit" name="submit" value="Section"></td>
                    </form>    
                </table>
            </center>  
            <?php
        
    }
    
    function add_new_student($choices){
        $_SESSION['page']="Add Student"
        ?>
        <center>
            <form name="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
            <table class="cog_etry">
               <caption class="cog_etry">Add Student To List</caption> 
                <tr> <td>ID No</td><td><input type="text" name="student_id"></input></td></tr>
                <tr> <td>Last Name</td><td><input style="width: 75%;" type="text" name="lname"></input></td></tr>
                <tr> <td>First Name</td><td><input style="width: 75%;" type="text" name="fname"></input></td></tr>
                <tr> <td>Middle Name</td><td><input style="width: 75%;" type="text" name="mname"></input></td></tr>
                <tr> <td>Address</td><td><input style="width: 100%;" type="text" name="address"></input></td></tr>
                <tr> <td>Gender</td><td><select name="gender"><option value="M">Male</option><option value="F">Female</option></select></td></tr>
                <tr> <td>Civil Status</td><td><select name="civil_status"><option value="Single">Single</option><option value="Married">Married</option></select></td></tr>
                <tr><td>Course:</td><td colspan="3"><center><select name="course"><?php foreach($choices as $courses){?><option value="<?php echo $courses['degreeid'];?>"><?php echo $courses['degreename'];}?></option></center></td><td></td><td></td></tr>
                
            </table>
            <input name="submit" type="submit" value="Add Student"></input>
            </form>
         </center>   
        <?php
    }
}
  ?>